#include "mainwindow.h"
#include "icon.h"
#include <QTranslator>
#include <QLibraryInfo>
#include <QLocale>
#include <QtPlugin>

#ifdef STATIC
Q_IMPORT_PLUGIN(qsvg);
#endif

int main(int argc, char *argv[]) {

	QApplication app(argc, argv);
	
	QString translationsPath;

	QTranslator qtTranslator;

#if defined(__MINGW32__) || defined(WIN32) || defined(_WIN32) || defined(__WIN32) || defined(_WIN64) || defined(__WIN64) || defined(__WINDOWS__) || defined(WINDOWS)
	translationsPath = QCoreApplication::applicationDirPath();
	translationsPath += "/translations/";
	qtTranslator.load(translationsPath + "colortool_" + QLocale::system().name());
#elif defined(__APPLE__) || defined(__APPLE) || defined(_APPLE) || defined(__MACH__) || defined(__MACH) || defined(_MACH)
	translationsPath = QCoreApplication::applicationDirPath();
	translationsPath = translationsPath.left((translationsPath.indexOf("colortool.app")+13));
	translationsPath += "/Contents/Resources/translations/";
	qtTranslator.load(translationsPath + "colortool_" + QLocale::system().name());
#elif defined(OS2) || defined(_OS2) || defined(__OS2__) || defined(__TOS_OS2__)
	translationsPath = QCoreApplication::applicationDirPath();
	translationsPath += "/translations/";
	qtTranslator.load(translationsPath + "colortool_" + QLocale::system().name());
#else
	translationsPath = "/usr/share/colortool/translations/";
	qtTranslator.load(translationsPath + "colortool_" + QLocale::system().name());
#endif

	app.installTranslator(&qtTranslator);

	colortoolWindow window;

	createAppIcon();

	window.setWindowIcon(QPixmap::fromImage(*AppIcon));

	window.show();

	return app.exec();

}
